package com.baizhi.service.impl;

import com.baizhi.entity.Atm;
import com.baizhi.mapper.AtmMapper;
import com.baizhi.service.AtmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(readOnly = false,timeout = 5,propagation = Propagation.REQUIRED,isolation = Isolation.READ_COMMITTED)

public class AtmServiceImpl implements AtmService {

    @Autowired
    private AtmMapper atmMapper;

    public void setAtmMapper(AtmMapper atmMapper) {
        this.atmMapper = atmMapper;
    }

    @Override
    public void insertAtm(Atm atm) {
        atmMapper.insertAtm(atm);
    }

    @Override
    public void deleteById(int id) {
        atmMapper.deleteById(id);
    }

    @Override
    public void updateAtm(Atm atm) {
        atmMapper.updateAtm(atm);
    }

    @Override
    @Transactional(readOnly = true)
    public Atm selectById(int id) {
        return atmMapper.selectById(id);
    }

    @Override
    @Transactional(readOnly = true)
    public List<Atm> selectAll(int pageNum, int pageSize) {
        return atmMapper.selectAll(pageNum, pageSize);
    }
}
